<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var identity = 'the window';

    let object = {
      identity: 'my object',
      getIdentityFunc1() {
        console.log(this); // object
        return function() {
          return this.identity; //window
        };
      },
      getIdentityFunc2() {
        console.log(this); // object
        return () => {
          return this.identity; // Object
        };
      },
      getIdentityFunc3() {
        console.log(this); // object
        let that = this; // 闭包的运用
        return function() {
          return that.identity; // object
        };
      }
    };

    console.log(object.getIdentityFunc1()());
    console.log(object.getIdentityFunc2()());
    console.log(object.getIdentityFunc3()());
  </script>
</body>

</html>